package com.kinger;

import java.io.IOException;

import com.metaio.sdk.MetaioDebug;
import com.metaio.tools.io.AssetsManager;

import android.app.Application;
import android.util.Log;

public class MyApp extends Application {

	@Override
	public void onCreate() {
		super.onCreate();
		extractAllAssets();
	}
	
	protected Boolean extractAllAssets(Integer... params) 
	{
		try 
		{
			// Extract all assets and overwrite existing files if debug build
			AssetsManager.extractAllAssets(getApplicationContext(), BuildConfig.DEBUG);
		} 
		catch (IOException e) 
		{
			MetaioDebug.log(Log.ERROR, "Error extracting assets: "+e.getMessage());
			MetaioDebug.printStackTrace(Log.ERROR, e);
			return false;
		}
		
		return true;
	}
}
